Declare Sub DirectedYield Lib "Kernel" (hTask As Integer)
'Declares for Hotkey
Declare Function GetAsyncKeyState Lib "User" (ByVal VKCODE%) As Integer
Declare Function PeekMessage Lib "User" (lpMsg As MSG, ByVal hWnd As Integer, ByVal wMsgFilterMin As Integer, ByVal wMsgFilterMax As Integer, ByVal wRemoveMsg As Integer) As Integer
Declare Function MessageReceived Lib "attsupp.dll" () As Long
Declare Function TaskWindow Lib "attsupp.dll" (ByVal hTask As Integer) As Integer
Declare Function PrinterStatus Lib "attsupp.dll" () As Integer
Declare Function PrinterJobs Lib "attsupp.dll" () As Integer
Declare Function ShowWindow Lib "User" (ByVal hWnd As Integer, ByVal nCmdShow As Integer) As Integer
Declare Function GetWindowText Lib "User" (ByVal hWnd As Integer, ByVal lpString As String, ByVal aint As Integer) As Integer
Declare Function GetWindow Lib "User" (ByVal hWnd As Integer, ByVal wCmd As Integer) As Integer
Declare Function GetTopWindow Lib "User" (ByVal hWnd As Integer) As Integer
Declare Function IsWindowEnabled Lib "User" (ByVal hWnd As Integer) As Integer
Declare Function IsWIndowVisible Lib "User" (ByVal hWnd As Integer) As Integer
Declare Function GetWindowLong Lib "User" (ByVal hWnd As Integer, ByVal nIndex As Integer) As Long
Declare Function SndPlaySOund Lib "MMsystem" (ByVal lpSound As String, ByVal Flags As Integer) As Integer
Global Const SND_NOSTOP = &H10
Global Const GWL_STYLE = (-16)
Global Const WS_POPUP = &H80000000
Global Const GW_HWNDFIRST = 0
Global Const GW_HWNDNEXT = 2
Global Const SW_RESTORE = 9
Global VK_Rotate1 As Integer
Global VK_Rotate2 As Integer
Global VK_Rotate3 As Integer
Global VK_Toggle1 As Integer
Global VK_Toggle2 As Integer
Global VK_Toggle3 As Integer
Global VK_Plus2 As Integer
Global VK_Plus3 As Integer
Global Const VK_SHIFT = &H10 'SHIFT key
Global Const VK_CONTROL = &H11 'CTRL key
Global Const VK_MENU = &H12 'ALT key
Global Const VK_R = &H52 'R key
Global Const VK_T = &H54 'T key
Declare Function GetModuleHandle% Lib "Kernel" (ByVal lpProgramName$)
Declare Function GetModuleUsage% Lib "Kernel" (ByVal hProgram%)
Declare Function GetActiveWindow Lib "User" () As Integer
Declare Function SetFocusAPI Lib "user" Alias "SetFocus" (ByVal hWnd As Integer) As Integer
Declare Function Ctl3dRegister Lib "CTL3D.DLL" (ByVal hInstance As Integer) As Integer
Declare Function Ctl3dAutoSubClass Lib "CTL3D.DLL" (ByVal hInstance As Integer) As Integer
Declare Function Ctl3dUnregister Lib "CTL3D.DLL" (ByVal hInstance As Integer) As Integer
Global Hw%
Global Const LOGPIXELSX = 88 ' Logical pixels/inch in X
Global Const LOGPIXELSY = 90 ' Logical pixels/inch in Y
'---Default distance units, based on font space...
Global gHStd As Integer
Global gVStd As Integer
'---Twips per pixel (horizontal & vertical)
Global GTwpsPerPxlX As Integer
Global GTwpsPerPxlY As Integer
Global yDPI As Integer
Global xDPI As Integer
'===============================
'*** API Functions
'===============================
Declare Function GetDeviceCaps Lib "GDI" (ByVal hDC As Integer, ByVal nIndex As Integer) As Integer
Sub Main ()
LastHour = -1
LastJob = -1
Hw% = GetModuleHandle("ATT.EXE")
gmu% = GetModuleUsage(Hw%)
If gmu% > 1 Then
'MsgBox ("Already running..." + Format$(gmu%))
AppActivate "AllTheTime"
End 'Program
End If
Y% = Ctl3dRegister(Hw%)
Y% = Ctl3dAutoSubClass(Hw%)
'---Get display's horizontal dots per logical inch, set gTwpsPerPxlX
xDPI = GetDeviceCaps(AllTheTime.hDC, LOGPIXELSX)
GTwpsPerPxlX = 1440 / xDPI
'---Get display's vertical dots per logical inch, set gTwpsPerPxlY
yDPI = GetDeviceCaps(AllTheTime.hDC, LOGPIXELSY)
GTwpsPerPxlY = 1440 / yDPI
Load Settings
AllTheTime.Show
WeHaveFocus = True
SetStayOnTop (Settings.StayOnTop.Value)
VK_Rotate1 = VK_CONTROL 'CTRL key
VK_Rotate2 = VK_MENU 'ALT key
VK_Toggle1 = VK_CONTROL 'CTRL key
VK_Toggle2 = VK_MENU 'ALT key
VK_Plus2 = VK_MENU 'ALT key
PlayOnceOnly% = True
Call SetSize
LastHour = -1
Call SetTime
PlayOnceOnly% = False
Do While DoEvents()
'Debug.Print PrinterStatus(), PrinterJobs()
'Debug.Print GetActiveWindow()
T& = MessageReceived()
'On Error Resume Next
TWind& = T& \ 65536
'If Err <> 0 Then MsgBox "Here 1"
'On Error Resume Next
TCommand& = T& Mod 65536
'If Err <> 0 Then MsgBox "Here 2"
'On Error GoTo 0
If TWind& = AllTheTime.hWnd Then
If TCommand& = IDM_EXIT Then
TTT% = SndPlaySOund("", 0) 'hush!
If MsgBox("Exit All The Time?", 4) = 6 Then
DeleteMenus
End 'Program
End If
End If
If TCommand& = IDM_SETTINGS Then
DblCFlag% = True
End If
If TCommand& = IDM_ABOUT Then
Form3.Show 1
End If
If ((TCommand& - IDM_TASKS) > 0) And ((TCommand& - IDM_TASKS) <= TaskListItems) Then